﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Text;
using System.Threading.Tasks;

namespace Wolfy.NetDisk.Data
{
    public class DbContextFactory : IDbContextFactory
    {
        private DbContext dbContext;
        public DbContextFactory()
        {

        }
        public DbContext GetContext()
        {
            dbContext = CallContext.GetData("Db") as Db;
            if (dbContext == null)
            {
                dbContext = new Db();
                CallContext.SetData("Db", dbContext);
            }

            return dbContext;
        }
    }
}
